home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctj8406.arc
/
MAINTAIN.PRG
< prev
next >
Wrap
Text File
|
1986-09-14
|
2KB
|
86 lines
* maintain.prg
*
*/this is a typical maintenance program used
*/with a data file indexed on 7 + 1 keys.
*/the eighth key is the social sec. no. this
*/program gives the user the facility to
*/access a record by name and to review, update,
*/or delete the record. the unique features are
*/the means by which we keep our special key
*/file (people1.dbf index soc) updated and
*/also the technique by which we ignore the
*/records marked for deletion. the other
*/seven indexes are the fields in the structure
*/of people.dbf.
SET talk OFF
ERASE
STORE ' ' TO vname
@ 10,00 SAY 'ENTER NAME YOU WANT ' GET vname
READ
CLEAR GETS
USE people INDEX name,birth,tel,add,desc,sal,cat
FIND &vname
*/this section checks for the existence of any
*/further records with this name and checks to
*/see if they are marked for deletion.
IF # = 0
@ 12,00 SAY 'NAME DOES NOT EXIST. HIT RETURN'
WAIT
RETURN
ENDIF # = 0
STORE 1 TO t
STORE 1 TO nn
DO WHILE t = 1
DO WHILE * .AND. name = vname .AND. .not. eof
SKIP
ENDDO WHILE * .AND. name = vname .AND. .not. eof
IF eof .OR. name # vname
IF nn = 1
@ 12,00 SAY 'NAME IS DELETED. HIT RETURN'
ELSE
@ 12,00 SAY 'NO MORE RECORDS. HIT RETURN'
ENDIF nn = 1
WAIT
STORE 0 TO t
LOOP
ENDIF eof .OR. name # vname
STORE 0 TO nn
ERASE
*/this section updates the record.
@ 03,00 SAY 'NAME'
@ 04,00 SAY 'SOC. SEC. # ' GET socsec
@ 05,00 SAY 'DATE OF BIRTH ' GET birth
@ 06,00 SAY 'TELEPHONE ' GET tel
@ 07,00 SAY 'ADDRESS ' GET address
@ 08,00 SAY 'SALARY ' GET salary
@ 09,00 SAY 'DESCRIPTION ' GET descript
@ 10,00 SAY 'CATEGORY ' GET category
@ 03,05 SAY name
READ
CLEAR GETS
*/this section illustrates the technique for
*/updating the special key file (people1.dbf).
STORE # TO rec
STORE socsec TO vsoc
USE people1 INDEX soc
GOTO rec
REPLACE socsec WITH vsoc
*/this section deletes record if desired.
STORE ' ' TO yn
@ 20,00 SAY 'DELETE THIS RECORD ? ' GET yn
READ
CLEAR GETS
IF !(yn) = 'Y'
DELETE
USE people
GOTO rec
DELETE
ENDIF
USE people INDEX name,birth,tel,add,desc,sal,cat
GOTO rec
SKIP
ENDDO WHILE t = 1
USE
RELEASE ALL
RETURN